//package com.demo.ai.config;
//
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.http.client.JdkClientHttpRequestFactory;
//import org.springframework.web.client.RestClient;
//
//import java.net.http.HttpClient;
//import java.time.Duration;
//
//@Configuration
//public class RestClientConfig {
//    @Bean
//    public RestClient.Builder ollamaRestClientBuilder() {
//        HttpClient httpClient = HttpClient.newBuilder()
//            .connectTimeout(Duration.ofSeconds(10)) // 设置连接超时时间为10秒
//            .build();
//        JdkClientHttpRequestFactory requestFactory = new JdkClientHttpRequestFactory(httpClient);
//        requestFactory.setReadTimeout(Duration.ofMinutes(3)); // 设置读取超时时间为3分钟
//        return RestClient.builder().clientConnector(new JettyClientConnector(requestFactory));
//    }
//}